package cn.hyy.hrm;


import cn.hyy.basic.util.AjaxResult;
import cn.hyy.basic.util.PageList;
import cn.hyy.hrm.doc.query.CourseDocumentQuery;
import cn.hyy.hrm.impl.CourseESClientImpl;
import cn.hyy.hrm.doc.CourseDoucment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * controller上的@RequestMapping("/course")
 * 添加到FeginClient中的path属性中
 */
@FeignClient(value = "ELASTICSEARCH-SERVICE",fallback = CourseESClientImpl.class,path = "/course")
//@RequestMapping("/course")
public interface CourseESClient {


    /**
     * 添加文档数据
     * @param courseDoucment
     * @return
     */
    @PostMapping("/save")
    AjaxResult save(@RequestBody CourseDoucment courseDoucment);


    /**
     * 批量添加文档数据
     * @param courseDoucments
     * @return
     */
    @PostMapping("/saveBathc")
    AjaxResult saveBathc(@RequestBody List<CourseDoucment> courseDoucments);


    /**
     * 删除文档数据
     * @param id
     * @return
     */
    @DeleteMapping("/delete")
    AjaxResult delete(@RequestParam("id") Long id);

    /**
     * 批量删除文档数据
     * @param ids
     * @return
     */
    @DeleteMapping("/deleteBatch")
    AjaxResult delete(@RequestBody List<Long> ids);
    /**
     * 检索文档数据
     * @return
     */
    @PostMapping("/search")
    PageList<CourseDoucment> search(@RequestBody CourseDocumentQuery query);

}
